/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import entity.Faq;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author VietTien
 */
@Stateless
public class FaqFacade extends AbstractFacade<Faq> {
    @PersistenceContext(unitName = "BluePumpkin-ejbPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public FaqFacade() {
        super(Faq.class);
    }

    public List<Faq> findByName(String q){
        Query query = em.createNamedQuery("Faq.findByQuestion");
        query.setParameter("question", q);
        return query.getResultList();
    }

}
